//
//  UILabel+Normal.m
//  DS_PJ_01
//
//  Created by admin on 16/7/16.
//  Copyright © 2016年 zhiqiyun. All rights reserved.
//

#import "UILabel+Normal.h"

@implementation UILabel(Normal)

#pragma mark - 计算高度

-(CGSize)compute_maxWidth
{
    return [UILabel sizeFontLabel:self.text font:self.font size:CGSizeMake(MAXFLOAT, self.frame.size.height)];
}

-(CGSize)compute_limitedWidth
{
    return [UILabel sizeFontLabel:self.text font:self.font size:CGSizeMake(self.frame.size.width, MAXFLOAT)];
}

+(CGSize)sizeFontLabel:(NSString *)text font:(UIFont *)font size:(CGSize)size
{
    
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
    paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
    NSDictionary *attributes = @{NSFontAttributeName:font, NSParagraphStyleAttributeName:paragraphStyle.copy};
    
    CGSize size1 = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
    
    return size1;
}

#pragma mark - 统一样式
+(UILabel *)shareTitleLabel
{
    UILabel *label = [[UILabel alloc]init];
    label.font = [UIFont systemFontOfSize:sFont_title];
    label.textColor = [UIColor blackColor] ;
    label.textAlignment = NSTextAlignmentLeft;
    label.lineBreakMode = NSLineBreakByCharWrapping;
    label.numberOfLines = 0;
    
    return label;
}


+(UILabel *)shareContentLabel
{
    UILabel *label = [[UILabel alloc]init];
    label.font = [UIFont systemFontOfSize:sFont_content];
    label.textColor = [UIColor blackColor] ;
    label.textAlignment = NSTextAlignmentLeft;
    label.lineBreakMode = NSLineBreakByCharWrapping;
    label.numberOfLines = 0;
    
    return label;
}


@end
